package jdbc.study.utils;

import jdbc.study.domain.*;
import jdbc.study.mapper.MovieCell;
import jdbc.study.mapper.RateCell;

import java.beans.IntrospectionException;
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class TestUnit {

    public void test() throws SQLException, IntrospectionException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
        MovieCell movieCell = new MovieCell();
        RateCell rateCell = new RateCell();
        Page page = new Page(1, 1000);
        JDBCInfo jdbcInfo = new JDBCInfo("jdbc:mysql://101.35.43.117/lifeDB", "root", "hias2023");
        List<Movie> movies = movieCell.selectList(page, jdbcInfo);
        List<Rate> rates = rateCell.selectList(page, jdbcInfo);
        rates.forEach(rate -> {
            System.out.println(rate.toString());
        });
        movies.forEach(movie -> {
            System.out.println(movie.toString());
        });
    }
}
